package com.cloudsigns.factorymanager2.engineering.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.engineering.activity.EngineeringEditFeedbackFragmentActivity;
import com.cloudsigns.factorymanager2.engineering.activity.EngineeringUseFragmentActivity;
import com.cloudsigns.factorymanager2.engineering.activity.SuccessOrderListForMnagerActivity;
import com.cloudsigns.factorymanager2.engineering.activity.DispatchEngineeringOrderListActivity;
import com.cloudsigns.factorymanager2.engineering.activity.EditEngineeringOrderListActivity;
import com.cloudsigns.factorymanager2.engineering.activity.ReceiveEngineeringOrderListActivity;

/**
 * 工程 工单管理 管理员
 * Created by tony on 2018/3/17.
 */

public class EngineeringOrderManagementForManageFragment extends Fragment implements View.OnClickListener {
    private RelativeLayout rl_receive_order, rl_edit_order, rl_assigned_order, rl_materials_of_recipients, rl_success_order,rl_materials_of_content;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_engineering_order_management_manage, null);
        rl_receive_order = view.findViewById(R.id.rl_receive_order);
        rl_edit_order = view.findViewById(R.id.rl_edit_order);
        rl_assigned_order = view.findViewById(R.id.rl_assigned_order);
        rl_materials_of_recipients = view.findViewById(R.id.rl_materials_of_recipients);
        rl_success_order = view.findViewById(R.id.rl_success_order);
        rl_materials_of_content=view.findViewById(R.id.rl_materials_of_content);


        rl_receive_order.setOnClickListener(this);
        rl_edit_order.setOnClickListener(this);
        rl_assigned_order.setOnClickListener(this);
        rl_materials_of_recipients.setOnClickListener(this);
        rl_success_order.setOnClickListener(this);
        rl_materials_of_content.setOnClickListener(this);
        return view;
    }

    @Override
    public void onClick(View view) {
        Intent mIntent;
        switch (view.getId()) {
            //接收工单
            case R.id.rl_receive_order:
                mIntent = new Intent(getActivity(), ReceiveEngineeringOrderListActivity.class);
                startActivity(mIntent);
                break;
            // 编辑工单
            case R.id.rl_edit_order:
                mIntent = new Intent(getActivity(), EditEngineeringOrderListActivity.class);
                startActivity(mIntent);
                break;
            // 分派工单
            case R.id.rl_assigned_order:
                mIntent = new Intent(getActivity(), DispatchEngineeringOrderListActivity.class);
                startActivity(mIntent);
                break;
            // 完工资料
            case R.id.rl_success_order:
                mIntent = new Intent(getActivity(), SuccessOrderListForMnagerActivity.class);
                startActivity(mIntent);
                break;
            // 工程领用
            case R.id.rl_materials_of_recipients:
                mIntent=new Intent(getActivity(), EngineeringUseFragmentActivity.class);
                startActivity(mIntent);
                break;
            // 编辑反馈
            case R.id.rl_materials_of_content:
                mIntent=new Intent(getActivity(), EngineeringEditFeedbackFragmentActivity.class);
                startActivity(mIntent);
                break;
        }
    }
}
